//
//  AddNewAddressView.m
//  JiaoX
//
//  Created by yinqy on 15/1/16.
//  Copyright (c) 2015年 北京娇羞科技有限公司. All rights reserved.
//

#import "AddNewAddressView.h"

#define ADDNEW_BTN_FONT_SIZE [DimensUtils getScaleX:15]

@interface AddNewAddressView()
{
    UIButton *_addNewBtn;
}

@end

@implementation AddNewAddressView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setFrame:CGRectMake(0, 0, JXScreenW, [DimensUtils getScaleX:60])];
        
        UIView *splite1  = [[UIView alloc]init];
        splite1.frame = CGRectMake(0, 15, JXScreenW, 0.5);
        [splite1 setBackgroundColor:JXColor(204, 204, 204)];
        [self addSubview:splite1];
        
        _addNewBtn = [[UIButton alloc]init];
        [_addNewBtn setFrame:CGRectMake(0, CGRectGetMaxY(splite1.frame), JXScreenW, 44)];
        [_addNewBtn setTitleEdgeInsets:UIEdgeInsetsMake(0, 5, 0, 0)];
        [_addNewBtn.titleLabel setFont:[UIFont systemFontOfSize:ADDNEW_BTN_FONT_SIZE]];
        [_addNewBtn setImage:[UIImage imageNamed:@"ic_address_new"] forState:UIControlStateNormal];
        [_addNewBtn setTitleColor:JXThemeColor forState:UIControlStateNormal];
        [_addNewBtn setTitle:@"新增地址" forState:UIControlStateNormal];
        [self addSubview:_addNewBtn];
        [_addNewBtn addTarget:self action:@selector(btnClick) forControlEvents:UIControlEventTouchUpInside];
        
        UIView *splite2  = [[UIView alloc]init];
        splite2.frame = CGRectMake(0, CGRectGetMaxY(_addNewBtn.frame), JXScreenW, 0.5);
        [splite2 setBackgroundColor:JXColor(204, 204, 204)];
        [self addSubview:splite2];
    }
    return self;
}

-(void)btnClick{
    if ([self.delegate respondsToSelector:@selector(addNewAddressBtnClick)]) {
        [_delegate addNewAddressBtnClick];
    }
}

@end
